package com.mall.ums.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mall.model.domain.ums.AdminRoleRelation;
import com.mall.ums.mapper.AdminRoleRelationMapper;
import com.mall.ums.service.AdminRoleRelationService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * @author clutchcitylee
 * @create 2023-03-12-10:12
 */
@Service
public class AdminRoleRelationServiceImpl extends ServiceImpl<AdminRoleRelationMapper, AdminRoleRelation> implements AdminRoleRelationService {

    @Override
    public void roleUpdate(Integer adminId, ArrayList<Integer> roleIds) {
        for (Integer roleId : roleIds) {
            AdminRoleRelation adminRoleRelation = new AdminRoleRelation();
            adminRoleRelation.setAdminId(Long.valueOf(adminId));
            adminRoleRelation.setRoleId(Long.valueOf(roleId));
            this.save(adminRoleRelation);
        }
    }
}
